package com.ndp.fb.rdb.model;

import com.ndp.fb.rdb.annotation.Column;
import com.ndp.fb.rdb.annotation.Id;
import com.ndp.fb.rdb.annotation.NoSave;
import com.ndp.fb.rdb.annotation.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by Sisi on 14-10-18.
 */
@Setter
@Getter
@NoArgsConstructor
@Table("entrust_account")
public class EntrustAccount implements Serializable {
    private static final long serialVersionUID = -599149894067162081L;
    /**
     * id
     */
    @Id
    private Long id;

    /**
     * fb_account_id
     */
    private Long fbAccountId;
    /**
     * name
     */
    private String name;
    /**
     * email
     */
    private String email;
    /**
     * account_status
     * 账号状态
     * 1 = Active
     * 2 = Disabled
     * 3 = Unsettled
     * 7 = Pending Review
     * 9 = In Grace Period
     * 101 = temporarily unavailable
     * 100 = pending closure.
     */
    private Integer accountStatus;
    /**
     * time_zone
     */
    @Column("time_zone")
    private String timezone;

    /**
     * custom_audience_tos
     * tos_accepted  接受服务条款   里面的custom_audience_tos  接受自定义受众服务条款  1代表接受
     */
    private Integer customAudienceTos;

    /**
     * balance
     */
    private Integer balance;

    /**
     * remark
     */
    private String remark;

    /**
     * create_time
     */
    private Date createTime;

    /**
     * update_time
     */
    private Date updateTime;

    /**
     * 删除标记 0:默认值，1删除
     * is_delete
     */
    private Integer isDelete;

    @NoSave
    @Column("is_support_cpa")
    private Boolean isSupportCPA;

    /**
     * 与Mysql无对应关系
     */
    @NoSave
    private Boolean isSupportInstagramAd;

    /**
     * 与Mysql无对应关系
     * 支持instagram 广告的ins账号  本来是多个ins账号
     */
    @NoSave
    private Long firstSupportInsAct;

    /**
     * 与Mysql无对应关系
     */
    @NoSave
    private Integer adCampaignCount;

    /**
     * 与Mysql无对应关系
     */
    @NoSave
    private Integer adSetCount;

    /**
     * adGroupCount
     */
    @NoSave
    private Integer adGroupCount;

    /**
     * isUpdatedResource
     * 是否己更新资源
     * 0：未更新 1己更新 (默认)
     */
    private Integer isUpdatedResource;


    public boolean isSupportInstagramAd() {
        return isSupportInstagramAd==null?false:isSupportInstagramAd;
    }

    public void setSupportInstagramAd(Boolean supportInstagramAd) {
        isSupportInstagramAd = supportInstagramAd;
    }
    public void setIsSupportInstagramAd(boolean supportInstagramAd) {
        isSupportInstagramAd = supportInstagramAd;
    }

    public void setSupportCPA(Boolean supportCPA) {
        isSupportCPA = supportCPA;
    }
    public void setIsSupportCPA(Boolean supportCPA) {
        isSupportCPA = supportCPA;
    }



    @Override
    public int hashCode() {
        return fbAccountId.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (obj instanceof EntrustAccount) {
            EntrustAccount other = (EntrustAccount) obj;
            if (fbAccountId == null) {
                if (other.getFbAccountId() != null) {
                    return false;
                }
            } else if (!fbAccountId.equals(other.getFbAccountId())) {
                return false;
            }
        }
        return true;
    }
}
